// microApp 微应用路由component采用CsMicroAppView，微应用的path前缀必需和注册微应用（microAppStore.setMicroAppMap）map的key一致
import { MicroAppView } from '@csui/micro-app'
import type { RouteRecordRaw } from 'vue-router'

const routers: RouteRecordRaw[] = [
  {
    path: '/root',
    redirect: '/root/home',
    meta: {
      title: '主应用',
      roles: ['admin', 'common']
    },
    children: [
      {
        path: '/root/home',
        name: 'Home',
        component: () => import('/@/views/home/index.vue'),
        meta: {
          title: '首页',
          isKeepAlive: true,
          isAffix: true,
          roles: ['admin', 'common'],
          icon: 'iconfont icon-shouye'
        }
      },
      {
        path: '/root/iframesTwo',
        name: 'layoutIframeViewTwo',
        component: () => import('/@/components/layout/router-view/parent.vue'),
        meta: {
          title: '内嵌iframe',
          // isLink: true,
          linkUrl: 'https://csui.csair.com',
          isKeepAlive: true,
          // isAffix: true,
          isIframe: true,
          roles: ['admin', 'common'],
          icon: 'iconfont icon-neiqianshujuchucun'
        }
      },
      {
        path: '/root/link',
        name: 'Link',
        component: () => import('/@/components/layout/router-view/link.vue'),
        meta: {
          title: '外链',
          roles: ['admin', 'common'],
          isLink: true,
          icon: 'iconfont icon-caozuo-wailian',
          linkUrl: 'https://csui.csair.com'
        }
      },
      {
        path: '/root/fun',
        name: 'Fun',
        component: () => import('/@/components/layout/router-view/parent.vue'),
        redirect: '/root/fun/fun1',
        meta: {
          title: '功能区',
          isKeepAlive: true,
          roles: ['admin', 'common'],
          icon: 'iconfont icon-caidan'
        },
        children: [
          {
            path: '/root/fun/fun1',
            name: 'Fun1',
            component: () => import('/@/views/fun/fun1/index.vue'),
            meta: {
              title: '功能区1',
              isKeepAlive: true,
              roles: ['admin', 'common']
            }
          },
          {
            path: '/root/fun/fun2',
            name: 'Fun2',
            component: () => import('/@/views/fun/fun2/index.vue'),
            meta: {
              title: '功能区2',
              isKeepAlive: true,
              roles: ['admin', 'common']
            }
          }
        ]
      },
      {
        path: '/root/multiple-micro',
        name: 'MultipleMicro',
        component: () => import('/@/views/multiple-micro/index.vue'),
        meta: {
          title: '多个微应用',
          roles: ['admin', 'common'],
          icon: 'iconfont icon-caozuo-wailian'
        }
      }
    ]
  },
  {
    path: '/micro_App',
    redirect: '/micro_App/fun/fun1',
    meta: {
      title: '乾坤子应用',
      roles: ['admin', 'common']
    },
    children: [
      {
        path: '/micro_App/fun',
        name: 'microApp@MicroAppFun',
        redirect: '/micro_App/fun/fun1',
        meta: {
          title: '功能区',
          roles: ['admin', 'common'],
          icon: 'iconfont icon-caidan'
        },
        children: [
          {
            path: '/micro_App/fun/fun1',
            name: 'micro_App@MicroAppFun1',
            component: MicroAppView,
            meta: {
              title: '功能区1',
              roles: ['admin', 'common'],
              isKeepAlive: false
            },
            children: [{
              path: '/micro_App/fun/fun1/children',
              name: 'micro_App@MicroAppFun1Children',
              component: MicroAppView,
              meta: {
                title: '功能区1-children',
                roles: ['admin', 'common'],
                isHide: true,
                isKeepAlive: false
              }
            }]
          },
          {
            path: '/micro_App/fun/fun2',
            name: 'micro_App@MicroAppFun2',
            component: MicroAppView,
            meta: {
              title: '功能区2',
              roles: ['admin', 'common'],
              isKeepAlive: false
            }
          }
        ]
      }
      // {
      //   path: '/micro_App/demo',
      //   redirect: '/micro_App/demo/table',
      //   meta: {
      //     title: '示例',
      //     isKeepAlive: true,
      //     roles: ['admin', 'common'],
      //     icon: 'iconfont icon-caidan'
      //   },
      //   children: [
      //     {
      //       path: '/micro_App/demo/table',
      //       redirect: '/micro_App/demo/table/table-action',
      //       meta: {
      //         title: '表格示例',
      //         isKeepAlive: true,
      //         roles: ['admin', 'common'],
      //         icon: 'iconfont icon-caidan'
      //       },
      //       children: [
      //         {
      //           path: '/micro_App/demo/table/table-action',
      //           name: 'micro_App@TableAction',
      //           component: MicroAppView,
      //           meta: {
      //             title: '表格操作',
      //             isKeepAlive: true,
      //             roles: ['admin', 'common']
      //           }
      //         }
      //       ]
      //     },
      //     {
      //       path: '/micro_App/demo/video',
      //       component: MicroAppView,
      //       name: 'micro_App@VideoIndex',
      //       meta: {
      //         title: '视频播放器',
      //         isKeepAlive: true,
      //         roles: ['admin', 'common']
      //       }
      //     },
      //     {
      //       path: '/micro_App/demo/org-tree',
      //       component: MicroAppView,
      //       name: 'micro_App@OrgTreeIndex',
      //       meta: {
      //         title: '组织架构图',
      //         isKeepAlive: true,
      //         roles: ['admin', 'common']
      //       }
      //     },
      //     {
      //       path: '/micro_App/demo/combination-tab',
      //       component: MicroAppView,
      //       name: 'micro_App@CombinationTabIndex',
      //       meta: {
      //         title: '组合页签',
      //         isKeepAlive: true,
      //         roles: ['admin', 'common']
      //       }
      //     },
      //     {
      //       path: '/micro_App/demo/card',
      //       component: MicroAppView,
      //       name: 'micro_App@CardIndex',
      //       meta: {
      //         title: '门户卡片',
      //         isKeepAlive: true,
      //         roles: ['admin', 'common']
      //       }
      //     }
      //   ]
      // }
    ]
  },
  {
    path: '/hrwauth',
    redirect: '/hrwauth/authority-type',
    meta: {
      title: '权限系统',
      roles: ['admin', 'common']
    },
    children: [
      {
        path: '/hrwauth/authority-type',
        component: MicroAppView,
        meta: {
          title: '数据权限类型',
          isKeepAlive: true,
          roles: ['admin', 'common'],
          icon: 'iconfont icon-caidan'
        }
      },
      {
        path: '/hrwauth/capabilities',

        component: MicroAppView,
        meta: {
          title: '系统功能配置',
          isKeepAlive: true,
          roles: ['admin', 'common'],
          icon: 'iconfont icon-caidan'
        },
        children: [
          {
            path: '/hrwauth/capabilities/capabilities-detail',
            component: MicroAppView,
            meta: {
              title: '功能菜单',
              isHide: true,
              roles: ['admin', 'common'],
              icon: 'iconfont icon-caidan'
            }
          }
        ]
      }
    ]
  },
  {
    path: '/hrwkpi',
    redirect: '/hrwkpi/performance-manage/indicator-library',
    meta: {
      title: '绩效管理',
      roles: ['admin', 'common']
    },
    children: [
      {
        path: '/hrwkpi/performance-manage/indicator-library',
        name: 'hrwkpi@IndicatorLibrary',
        component: MicroAppView,
        meta: {
          title: '指标库管理',
          isKeepAlive: true,
          roles: ['admin', 'common'],
          icon: 'iconfont icon-caidan'
        }
      },
      {
        path: '/hrwkpi/performance-manage/task-decoding-graph',
        name: 'hrwkpi@DecodingGraph',
        component: MicroAppView,
        meta: {
          title: '策略解码图',
          isKeepAlive: true,
          roles: ['admin', 'common'],
          icon: 'iconfont icon-caidan'
        }
      }
    ]
  },
  {
    path: '/hrwtalent',
    redirect: '/hrwtalent/talent-pool',
    meta: {
      title: '人才系统',
      roles: ['admin', 'common']
    },
    children: [
      {
        path: '/hrwtalent/talent-pool',
        redirect: '/hrwtalent/talent-pool/information-manage',
        component: MicroAppView,
        meta: {
          title: '人才库',
          roles: ['admin', 'common']
        },
        children: [
          {
            path: '/hrwtalent/talent-pool/information-manage',
            component: MicroAppView,
            props: {
              delay: 2000
            },
            meta: {
              title: '人才库信息管理',
              isKeepAlive: true,
              roles: ['admin', 'common'],
              icon: 'iconfont icon-caidan'
            },
            children: [
              {
                path: '/hrwtalent/talent-pool/information-manage/talent-pool-personnel-details',
                component: MicroAppView,
                props: {
                  delay: 2000
                },
                meta: {
                  title: '人才库人员详情',
                  isKeepAlive: true,
                  isHide: true,
                  roles: ['admin', 'common'],
                  icon: 'iconfont icon-caidan'
                },
                children: [
                  {
                    path: '/hrwtalent/talent-pool/information-manage/talent-pool-personnel-details/talent-pool-inventory-management',
                    component: MicroAppView,
                    props: {
                      delay: 2000
                    },
                    meta: {
                      title: '人才库出入库',
                      isKeepAlive: true,
                      isHide: true,
                      roles: ['admin', 'common'],
                      icon: 'iconfont icon-caidan'
                    }
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  },
  {
    path: '/hrwleave',
    redirect: '/hrwleave/leave-application-management',
    meta: {
      title: '时间管理',
      roles: ['admin', 'common']
    },
    children: [
      {
        path: '/hrwleave/leave-application-management',
        name: 'hrwleave@LeaveApplicationManagement',
        component: MicroAppView,
        meta: {
          title: '休假申请管理',
          isKeepAlive: true,
          roles: ['admin', 'common'],
          icon: 'iconfont icon-caidan'
        }
      },
      {
        path: '/hrwleave/leave-quota',
        name: 'hrwleave@LeaveQuota',
        component: MicroAppView,
        meta: {
          title: '休假额度管理',
          isKeepAlive: true,
          roles: ['admin', 'common'],
          icon: 'iconfont icon-caidan'
        }
      },
      {
        path: '/hrwleave/leave-type',
        name: 'hrwleave@VacationCategory',
        component: MicroAppView,
        meta: {
          title: '休假类别管理',
          // isKeepAlive: true,
          roles: ['admin', 'common'],
          icon: 'iconfont icon-caidan'
        }
      },
      {
        path: '/hrwleave/leave-visit-family',
        name: 'hrwleave@ManagementOfFamilyLeave',
        component: MicroAppView,
        meta: {
          title: '探亲假管理',
          // isKeepAlive: true,
          roles: ['admin', 'common'],
          icon: 'iconfont icon-caidan'
        }
      }
    ]
  }
]

export default routers
